package com.xidian.zhiancloud.controller.luling.PointPart;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.model.ActiOperStatus;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.service.luling.PointPart.ActiOperStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
/**
 * 作业活动清单
 *
 * @Author: luling
 * @Date: 2021/1/3 00:26
 */
@RestController
@RequestMapping("/ActiOperStatus")
public class ActiOperStatusController {
    @Autowired
    private ActiOperStatusService actiOperStatusService;
    /**
     * 增加作业活动清单信息
     *
     * @param  actiOperStatus 作业活动清单对象
     * @return 是否添加成功
     */
    @PostMapping("/add")
    public ResultDTO<Boolean> add( ActiOperStatus  actiOperStatus) {
        actiOperStatusService.save(actiOperStatus);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     * 根据id获取作业活动清单对象
     *
     * @param id 作业活动清单对象的id
     * @return 作业活动清单对象
     */
    @GetMapping("/getById")
    public ResultDTO<ActiOperStatus> getById(@RequestParam("id") Long id) {
        return ResultDTO.successOf(actiOperStatusService.getById(id), GeneralResponseEnums.SUCCESS);
    }
    /**
     * 根据id删除作业活动清单信息
     *
     * @param ids ids数组
     * @return 是否删除成功
     */
    @DeleteMapping("/deleteByIds")
    public ResultDTO<Boolean> deleteByIds(Long[] ids) {
        actiOperStatusService.removeByIds(Arrays.asList(ids));
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     * 根据id修改作业活动清单对象
     *
     * @param  actiOperStatus 作业活动清单对象
     * @return 是否修改成功
     */
    @PatchMapping("/patchById")
    public ResultDTO<Boolean> patchById(ActiOperStatus actiOperStatus) {
        actiOperStatusService.updateById(actiOperStatus);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
//    /**
//     * 列表查询
//     * @param actiOperStatusQO 查询参数
//     * @return 作业活动清单列表
//     */
//    @GetMapping("/getList")
//    public ResultDTO<IPage<ActiOperStatusVO>> getListByQueryObject(ActiOperStatusQO actiOperStatusQO) {
//        return ResultDTO.successOf(actiOperStatusService.getListByQO(actiOperStatusQO), GeneralResponseEnums.SUCCESS);
//    }
}
